package com.dachuang.canjiren.controller;


import com.dachuang.canjiren.service.CommentService;
import com.dachuang.canjiren.service.LawService;
import com.dachuang.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author testjava
 * @since 2020-07-27
 */
@RestController
@RequestMapping("/canjiren/law")
public class LawController {

    @Autowired
    private LawService lawService;

    @GetMapping(value = "insertLaw")
    R insertLaw(
            @RequestParam(value = "userId", required = false) Integer userId,
            @RequestParam(value = "title", required = false) String title,
            @RequestParam(value = "content", required = false) String content,
            @RequestParam(value = "name", required = false) String name,
            @RequestParam(value = "status", required = false) Integer status) {
        return lawService.insertLaw(userId,title,content,name,status);
    }

    @GetMapping("selectLaw")
    R selectLaw(Integer id){
        return lawService.selectLaw(id);
    }
    @GetMapping(value = "Lawlist")
    R Lawlist(){
        return lawService.selectLawList();
    }

}

